package com.okex.open.api;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class CyclicBarrierBuy extends TradeAPIBaseTest{

    /**
     * 获取指定时间对应的毫秒数
     *
     * @param time "HH:mm:ss"
     * @return
     */
    private static long getTimeMillis(String time)
    {
        try
        {
            DateFormat dateFormat = new SimpleDateFormat("yy-MM-dd HH:mm:ss:SSS");
            DateFormat dayFormat = new SimpleDateFormat("yy-MM-dd");
            Date curDate = dateFormat.parse(dayFormat.format(new Date()) + " " + time);
            return curDate.getTime();
        }
        catch (ParseException e)
        {
        }
        return 0;
    }
    public static void main(String[] args) {
        TradeAPITest tradeAPITest =new TradeAPITest();
        tradeAPITest.before();
        long oneDay = 24 * 60 * 60 * 1000;
        ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
        System.out.println("okex抢币客户端");
        //1
        ses.scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                tradeAPITest.keepplaceOrderBuy(Long.valueOf(args[0]));
                }
        }, 0,oneDay,TimeUnit.MILLISECONDS);
    }

}
